#include <stdint.h>
#include "stm32_common.h"

extern void Reset_Handler(void);
extern void NMI_Handler(void);
extern void HardFault_Handler(void);
extern void MemManage_Handler(void);
extern void BusFault_Handler(void);
extern void SVC_Handler(void);
extern void DebugMon_Handler(void);
extern void PendSV_Handler(void);
extern void SysTick_Handler(void);
extern void UsageFault_Handler(void);
extern unsigned int _sidata,_sdata,_edata,__bss_start__,__bss_end__; 

//定义向量表
//函数指针 void (*)(void)
//void (*a[])(void) 函数指针数组
//void (const *a[])(void)  void (const [*a[]])(void)  函数的内容不可变 
__attribute__ ((section("vectors"))) void (* const VectorArray[])(void)={
    //内核中断
    (void*)STACK_TOP,
    Reset_Handler,
    NMI_Handler,
    HardFault_Handler,
    MemManage_Handler,
    BusFault_Handler,
    UsageFault_Handler,
    0,
    0,
    0,
    0,
    SVC_Handler,
    DebugMon_Handler,
    0,
    PendSV_Handler,
    SysTick_Handler
    //外设中断

};

void stm32_copydata(unsigned int *form,unsigned int *section_begin,unsigned int *section_end)
{
    unsigned int *p;
    p = section_begin;
    while(p<section_end)
    {
        *p++ = *form++;
    }
}

void stm32_bssinit(unsigned int *startbss,unsigned int *endbss)
{
  unsigned int *p;
  p = startbss;
  while(p<endbss)
  {
    *p++ = 0;
  }
}



